srvMap.add('vstDistributionLastMonth', '','front/sh/screen!execute?uid=vstDistributionLastMonth');//全国来桂人数分布图
srvMap.add('cntAndmonthlydistrb', '','front/sh/screen!execute?uid=cntAndmonthlydistrb');//--来桂总人数&月份分布
srvMap.add('vstDistInProv', '','front/sh/screen!execute?uid=vstDistInProv');//全省景区客流分布
srvMap.add('hotRankSpotLastMonth', '','front/sh/screen!execute?uid=hotRankSpotLastMonth');//上月景区热度排行
srvMap.add('regionClassList', '','front/sh/screen!execute?uid=regionClassList');//景区分类
srvMap.add('agentClassList', '','front/sh/screen!execute?uid=agentClassList');//旅行社分类
srvMap.add('queryClassList', '','front/sh/screen!execute?uid=queryClassList');
//srvMap.add('queryClassChartsList', '','front/sh/screen!execute?uid=queryClassChartsList');//全国来桂人数分布图
var myChart_sourceMapCharts; //全国来桂人数分布图
var myChart_sourceLineCharts; //全国来桂当年折线图
var myChart_regionPieCharts; //景区分类饼图
var myChart_agentBarCharts; //旅行社分柱状图
var myChart_hotelPieCharts; //酒店分类饼图
var myChart_guideBarCharts; //导游分类柱状图
var myChart_regionMapCharts; //景区客流分布图
var myChart_emptyLineCharts;
var currentYear = '';
var currentMonth = '';
var prov_name_short =DEPLOY_PROVINCE_NAME_SHORT;//省份短名称

$(function() {
	// 刷新当前时间
	reflashTime();

	//初始化月份选择
	initMonth();

	//初始化点击进入客流监控平台
	initInExtendSystem();

	//初始化页面基本信息
	initPage();
});

/**
 * 初始化页面基本信息
 */
function initPage() {
	//初始化模块标题
	showTitle();

	//初始化全国各省来桂人数分布图
	showSourceMapCharts(false);

	//初始化来桂总人数及当年分布
	showSourceLineCharts();

	//初始化当月景区热度排行Top5
	showRegionTable();

	//初始化分类区域图标
	showClassCharts();

	//初始化景区客流分布图
	showRegionMapCharts();
	
	//设置景区客流分布刷新任务
	refreshRegionMapCharts();
	
	//绑定事件
	$(document).ready(function(){
		$('#bcycIdSelectDiv').mouseover(
			function(){
				$('#bcycIdBgId').show();
				$('#bcycIdContentDiv').show();
			}
		);
		
		$('#bcycIdContentDiv').hover(
			function(){
				$('#bcycIdBgId').show();
				$('#bcycIdContentDiv').show();
			},function(){
				$('#bcycIdBgId').hide();
				$('#bcycIdContentDiv').hide();
			}
		);
	});
}

/**
 * 初始化页面基本信息
 */
function refreshPage() {
	//初始化模块标题
	showTitle();

	//初始化全国各省来桂人数分布图
	showSourceMapCharts(false);

	//初始化来桂总人数及当年分布
	showSourceLineCharts();	//涉及到跨年，所以也得更新
	
	//初始化当月景区热度排行Top5
	showRegionTable();

	//初始化分类区域图标
	showClassCharts();
}

//var url = CONTENT_PATH + "/com.asiainfo.zhly.SceneMonitorAction.queryRegionTop10.invoke";
//var data = {
//	searchValue: searchValue,
//	cityId: checkCityId,
//	regionType: checkRegionType
//};
//var par = "&searchValue="+searchValue+"&cityId="+checkCityId+"&regionType="+checkRegionType;
//Util.ajax.postJsonSync(srvMap.get('queryRegionTop10'),par,function(json,status){
//	if(status){
//		builTop10(json.object.regions);
//	}else{
//		 alert('错误','数据异常！');   
//	}
//});
//Base.ajax({
//	url: url,
//	data: data,
//	async: false,
//	success: function(req) {
//		if (req == null) {
//			return;
//		}
//		builTop10(req.result);
//	}
//});
/**
 * 初始化全国各省来桂人数分布图
 */
function showSourceMapCharts(isFullScreen) {

	//var url = CONTENT_PATH + "/com.asiainfo.zhly.ScreenAction.querySourceDataList.invoke";
	var bcycId = $('#yearValue').val() + $('#monthValue').val();
	var par = "&bcycId="+bcycId;
	//var data = {
	//	"bcycId": bcycId
	//}
	//alert(bcycId);
	Util.ajax.postJsonSync(srvMap.get('vstDistributionLastMonth'),par,function(json,status){
		//alert(json.object.regions);
		hideLoading(myChart_sourceMapCharts);
		if(!status){
			noDataShowSource(myChart_sourceMapCharts, 'sourceChartsId');
			return;
		}else{
			//alert("true"+json.object.regions.length);
			var data_map = json.object.regions.sourceList;

			var lineData = [];
			var valueData = [];
			var realProName = DEPLOY_PROVINCE_NAME_SHORT;	//迁徙目的地

			for (var i = 0; i < data_map.length; i++) {
				var proName = data_map[i].prov_name;
				var proValue = data_map[i].vst_cnts;

				var proObj2 = [{
					"name": proName,
					"value": proValue
				}, {
					"name": realProName
				}];

				var proObj3 = {
					"name": proName,
					"value": proValue
				};
				lineData.push(proObj2);
				valueData.push(proObj3);
			}
			
//			//确定边界
//			var edge1 = {start:req.data.edgeInfo[0],end:req.data.edgeInfo[1]};
//			var edge2 = {start:req.data.edgeInfo[2],end:req.data.edgeInfo[3]};
//			var edge3 = {start:req.data.edgeInfo[4],end:req.data.edgeInfo[5]};
//			var edge4 = {start:req.data.edgeInfo[6],end:req.data.edgeInfo[7]};
//			var edge5 = {start:req.data.edgeInfo[8],end:req.data.edgeInfo[9]};
			//确定边界
			var edge1 = {start:json.object.regions.edgeInfo[0],end:json.object.regions.edgeInfo[1]};
			var edge2 = {start:json.object.regions.edgeInfo[2],end:json.object.regions.edgeInfo[3]};
			var edge3 = {start:json.object.regions.edgeInfo[4],end:json.object.regions.edgeInfo[5]};
			var edge4 = {start:json.object.regions.edgeInfo[6],end:json.object.regions.edgeInfo[7]};
			var edge5 = {start:json.object.regions.edgeInfo[8],end:json.object.regions.edgeInfo[9]};
			
			//设置地市label尺寸
			var _fontSize = 12;
			if(isFullScreen){
				_fontSize = 20;
			}
			
			require.config({
				paths: {
					echarts: CONTENT_PATH + '/common/js'
				}
			});
			require(['echarts', 'echarts/chart/map', 'echarts/chart/line'], function(ec) {
				option = {
					tooltip: {	//大宽，黄色高亮tip
						trigger: 'item',
						borderRadius: 8,
						borderWidth: 2,
						padding: 10,
						textStyle: {
							color: 'yellow',
							decoration: 'none',
							fontFamily: 'Verdana, sans-serif',
							fontSize: 15,
							fontStyle: 'italic',
							fontWeight: 'bold'
						},
						formatter: function(a, b) {
							if( a.value.length == 0 ){
								return '';
							}							
							return a.value + '人数';
						}
					},
					title: {
						text: '',
						x: 'center'
					},
					dataRange: {
						x: 'left',
						y: 'bottom',
						text: ['高', '低'], // 文本，默认为数值文本
						splitList:[
							edge5,
							edge4,
							edge3,
							edge2,
							edge1
						],
						calculable: false,
						color: ['#FD3023', '#FF7200', '#FFAE00', '#9BC702', '#46B035'],
						show: true,
						textStyle: {
							color: '#FFFFFF',
							fontSize: _fontSize
						}
					},
					series: [{
						type: 'map',
						mapType: 'china',
						roam: false,
						hoverable: false,
						tooltip:{
							show:false
						},
						itemStyle: {
							normal: {
								label: {
									show: true,
									textStyle: {	//地址名称
										color: 'rgba(249,249,249,1)',
										fontSize: _fontSize
									}
								},
								borderColor: 'rgba(46,199,201,1)',
								borderWidth: 1,
								areaStyle: {
									color: '#000'	//地市填充色
								}
							},
							emphasis: {
								label: {
									show: false
								}
							}
						},
						geoCoord: {
							'安徽': [117.29, 32.0581],
							'江苏': [119.7150, 32.7118],
							'浙江': [120.6717, 29.6999],
							'河南': [113.4668, 34.6234],
							'上海': [121.4648, 31.2891],
							'山东': [117.1582, 36.8701],
							'广东': [113.5107, 23.2196],
							'湖北': [114.3896, 30.6628],
							'北京': [116.4551, 40.2539],
							'江西': [116.0046, 28.6633],
							'河北': [114.4995, 38.1006],
							'福建': [119.4543, 25.9222],
							'四川': [103.9526, 30.7617],
							'湖南': [113.0823, 28.2568],
							'陕西': [109.1162, 34.2004],
							'山西': [112.3352, 37.9413],
							'辽宁': [123.1238, 42.1216],
							'重庆': [107.7539, 30.1904],
							'天津': [117.4219, 39.4189],
							'新疆': [87.9236, 43.5883],
							'甘肃': [103.5901, 36.3043],
							'贵州': [106.6992, 26.7682],
							'黑龙江': [127.9688, 46.368],
							'云南': [102.9199, 24.4663],
							'广西': [108.479, 23.1152],
							'吉林': [125.8154, 44.2584],
							'内蒙古': [111.4124, 40.4901],
							'宁夏': [106.3586, 38.1775],
							'海南': [110.3893, 19.8516],
							'青海': [99.4038, 36.8207],
							'西藏': [91.1865, 30.1465]
						},
						data:[]
					},{
						type: 'map',
						mapType: 'china',
						data:[],
						markPoint: {
							symbol: 'emptyCircle',
							symbolSize: function(v) {	//标注大小
								var size = 4;
								if( v >= edge2.start && v < edge3.start ){
									size+=1;
								}else if( v >= edge3.start && v < edge4.start ){
									size+=2;
								}else if( v >= edge4.start && v < edge5.start ){
									size+=3;
								}else if( v >= edge5.start ){
									size+=4;
								}
								return size;
							},
							effect: {	//标注图形炫光特效
								show: true,
								shadowBlur: 0	//光影模糊度
							},
							itemStyle: {
								normal: {
									label: {
										show: false
									}
								}
							},
							data: valueData
						}
					},{
						type: 'map',
						mapType: 'china',
						data:[],
						markLine: {
							smooth: true,
							symbol: ['none', 'circle'],
							symbolSize : 1,
							effect: {
								show: true,
								scaleSize: 1,
								period: 30,
								color: '#fff',
								shadowBlur: 10
							},
							itemStyle: {
								normal: {
									borderWidth: 1.2,
									lineStyle: {
										type: 'solid',
										shadowBlur: 10
									},
									label: {
										show: false
									}
								}
							},
							data: lineData
						}
					}]
				};

				myChart_sourceMapCharts = ec.init(document.getElementById('sourceChartsId'), 'macarons');
				myChart_sourceMapCharts.clear();
				myChart_sourceMapCharts.setOption(option);
			});
		}
	});
}

/**
 * 初始化来桂总人数及月份分布
 */
function showSourceLineCharts() {
	//var url = CONTENT_PATH + "/com.asiainfo.zhly.ScreenAction.querySourceYearList.invoke";
	//var bcycId = $('#yearValue').val() + $('#monthValue').val();
	//var data = {
	//	"bcycId": bcycId
	//};
//	Base.ajax({
//		url: url,
//		data: data,
//		success: function(req) {
	var bcycId = $('#yearValue').val() + $('#monthValue').val();
	var par = "&bcycId="+bcycId;
	//var data = {
	//	"bcycId": bcycId
	//}
	//alert(bcycId);
	Util.ajax.postJsonSync(srvMap.get('cntAndmonthlydistrb'),par,function(json,status){
			if (null == json.object.regions || null == json.object.regions.yearUserCount) {
				$('#userCountULId').html('数据加载中');
			} else {
				var userCountHtml = '';
				var userCount = json.object.regions.yearUserCount + '';
				var index = 0;
				
				//加载数字时钟样式
				for (var i = userCount.length - 1; i >= 0; i--) {
					if (index < 4) {
						userCountHtml = '<li class="em">' + userCount.charAt(i) + '</li>' + userCountHtml;
					} else if (index < 8){
						userCountHtml = '<li>' + userCount.charAt(i) + '</li>' + userCountHtml;
					}else{
						userCountHtml = '<li style="color:#ff6410";>' + userCount.charAt(i) + '</li>' + userCountHtml;
					}
					index += 1;
				}
				$('#userCountULId').html(userCountHtml);
			}

			var data_sort = json.object.regions.yearSortList;
			showSortDataSecond(data_sort); //显示当年前三

			var data_line = json.object.regions.yearDataList;
			showLineCharts(data_line); //绘制当年来桂人数折线图
		});
}

/**
 * 绘制当年来桂人数折线图
 * @param data_line
 */
function showLineCharts(data_line) {
	hideLoading(myChart_sourceLineCharts);
	if (null == data_line || data_line.length == 0) {
		noDataShowSource(myChart_sourceLineCharts, 'screenLineChartsId');
		return;
	}
	var dataLine = [];
	for (var i = 0; i < data_line.length; i++) {
		var proValue = data_line[i].vst_cnts || 0;
		var opTime = data_line[i].op_time;
		
		var mon = parseInt(opTime.substring(4,6));
		dataLine[mon-1] = proValue;
	}

	require.config({
		paths: {
			echarts: CONTENT_PATH + '/common/js'
		}
	});
	require(['echarts', 'echarts/chart/line'], function(ec) {
		option = {
			title: {
				text: '',
				x: 'center'
			},
			tooltip: {
				trigger: 'axis',
				axisPointer: { // 坐标轴指示器，坐标轴触发有效
					//type : 'line'        // 默认为直线，可选为：'line' | 'shadow'
				},
				formatter: function(params) {
					var personCnt = 0;
					if( params[0].value != null && params[0].value != "-" ){
						personCnt = params[0].value;
					}
					return params[0].name + params[0].seriesName + ' : <br/>' + Number(Number(personCnt)/10000.0).toFixed(2) + '万人数';
				}
			},
			calculable: false,
			xAxis: [{
				name: '月份',
				type: 'category',
				boundaryGap: false,
				data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
				axisLabel: {
					textStyle: {
						color: '#FFFFFF',
						fontSize: 12
					}
				},
				splitLine : {
	                show:false,
	                lineStyle: {  //设置网格与y轴平行的线的样式，颜色、字体、宽、线的样式
	                    color: '#333333',
	                    width: 1
	                }
	            }
			}],
			yAxis: [{
				name: '总人数',
				type: 'value',
				axisLabel: {
					//formatter: '{value}',
					formatter: function(v){
						return v / 10000 + '万人数';
					},
					textStyle: {
						color: '#FFFFFF',
						fontSize: 12
					}
				},
				splitLine : {
	                show:true,
	                lineStyle: {
	                    color: '#333333',
	                    width: 1
	                }
	            }
			}],
			series: [{
				name: '来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'人数',
				type: 'line',
				data: dataLine,
				itemStyle: {
					normal: {
						lineStyle: {
							type: 'solid',
							width: 3
						}
					}
				},
				markPoint: {
					data: [{
						type: 'max',
						name: '最大值',
						itemStyle: {
							normal: {
								label: {
									formatter: function(param){
										return Number(param.value / 10000).toFixed(2) + '万人数';
									}
								}
							}
						},
						tooltip: {
							show: false
						}
					}]
				}
			}]
		};
		myChart_sourceLineCharts = ec.init(document.getElementById('screenLineChartsId'), 'macarons');
		myChart_sourceLineCharts.clear();
		myChart_sourceLineCharts.setOption(option);
	});
}

/**
 * 显示当年来桂人数前三
 * @param data_sort
 */
function showSortDataSecond(data_sort) {
	var topHtml = '';
	if (data_sort == null || data_sort.length == 0) {
		$('#top3DivId').html(topHtml);
		noDataShowSource(myChart_emptyLineCharts, 'top3DivId');
		return;
	}
	if (data_sort.length >= 1) {
		topHtml += '<div class="lgscreen-month-box lgscreen-fcolor">' + '<h2>' + Number(Number(data_sort[0].vst_cnts)/10000.0).toFixed(0) + '<span class="sp">万</span></h2><h3>' +  Number(data_sort[0].op_time.substring(4, 6)) + '月份来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'<br/>人数</h3>' + '</div>';
	}
	if (data_sort.length >= 2) {
		topHtml += '<div class="lgscreen-month-box lgscreen-scolor">' + '<h2>' + Number(Number(data_sort[1].vst_cnts)/10000.0).toFixed(0) + '<span class="sp">万</span></h2><h3>' +  Number(data_sort[1].op_time.substring(4, 6)) + '月份来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'<br/>人数</h3>' + '</div>';
	}
	if (data_sort.length >= 3) {
		topHtml += '<div class="lgscreen-month-box lgscreen-tcolor">' + '<h2>' + Number(Number(data_sort[2].vst_cnts)/10000.0).toFixed(0) + '<span class="sp">万</span></h2><h3>' +  Number(data_sort[2].op_time.substring(4, 6)) + '月份来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'<br/>人数</h3>' + '</div>';
	}
	$('#top3DivId').html(topHtml);
}

/**
 * 显示当年来桂人数前三
 * @param data_sort
 */
function showSortData(data_sort) {
	//var emptyHtml = '<h4>数据加载中</h4>';
	if (data_sort == null || data_sort.length == 0) {
		$('#top1Div').html(emptyHtml);
		$('#top2Div').html(emptyHtml);
		$('#top3Div').html(emptyHtml);
	} else if (data_sort.length == 1) {
		var top1Html = '<h2>' + data_sort[0].vst_cnts + '</h2><h3>' + Number(data_sort[0].op_time.substring(0, 4)) + '年' + Number(data_sort[0].op_time.substring(4, 6)) + '月份<br/>来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'人数</h3>';
		$('#top1Div').html(top1Html);
		$('#top2Div').html(emptyHtml);
		$('#top3Div').html(emptyHtml);
	} else if (data_sort.length == 2) {
		var top1Html = '<h2>' + data_sort[0].vst_cnts + '</h2><h3>' + Number(data_sort[0].op_time.substring(0, 4)) + '年' + Number(data_sort[0].op_time.substring(4, 6)) + '月份<br/>来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'人数</h3>';
		var top2Html = '<h2>' + data_sort[1].vst_cnts + '</h2><h3>' + Number(data_sort[1].op_time.substring(0, 4)) + '年' + Number(data_sort[1].op_time.substring(4, 6)) + '月份<br/>来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'人数</h3>';
		$('#top1Div').html(top1Html);
		$('#top2Div').html(top2Html);
		$('#top3Div').html(emptyHtml);
	} else if (data_sort.length == 3) {
		var top1Html = '<h2>' + data_sort[0].vst_cnts + '</h2><h3>' + Number(data_sort[0].op_time.substring(0, 4)) + '年' + Number(data_sort[0].op_time.substring(4, 6)) + '月份<br/>来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'人数</h3>';
		var top2Html = '<h2>' + data_sort[1].vst_cnts + '</h2><h3>' + Number(data_sort[1].op_time.substring(0, 4)) + '年' + Number(data_sort[1].op_time.substring(4, 6)) + '月份<br/>来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'人数</h3>';
		var top3Html = '<h2>' + data_sort[2].vst_cnts + '</h2><h3>' + Number(data_sort[2].op_time.substring(0, 4)) + '年' + Number(data_sort[2].op_time.substring(4, 6)) + '月份<br/>来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'人数</h3>';
		$('#top1Div').html(top1Html);
		$('#top2Div').html(top2Html);
		$('#top3Div').html(top3Html);
	}
}

/**
 * 初始化当月景区热度排行Top5
 */
function showRegionTable() {
//	var url = CONTENT_PATH + "/com.asiainfo.zhly.ScreenAction.queryRegionMonthDataList.invoke";
//	var bcycId = $('#yearValue').val() + $('#monthValue').val();
//	var data = {
//		"bcycId": bcycId
//	};
//	Base.ajax({
//		url: url,
//		data: data,
//		success: function(req) {
	var bcycId = $('#yearValue').val() + $('#monthValue').val();
	var par = "&bcycId="+bcycId;
	//var data = {
	//	"bcycId": bcycId
	//}
	//alert(bcycId);
	Util.ajax.postJsonSync(srvMap.get('hotRankSpotLastMonth'),par,function(json,status){
	
			if (null == json.object || null == json.object.regionMonthList || json.object.regionMonthList.length == 0) {
				$('#regionULId').html();
				noDataShowSource(myChart_emptyLineCharts, 'regionULId');
				return;
			}

			var regionULHtml = '';
			var regionList = json.object.regionMonthList;
			for (var i = 0; i < regionList.length; i++) {
				if (i < 3) {
					regionULHtml += '<li><em class="border3">' + (i + 1) + '</em><span>' + regionList[i].region_name + '</span><p>' + regionList[i].vst_cnts + '<span class="sp">人数</span></p></li>';
				} else if (i > 4) {
					break;
				} else {
					regionULHtml += '<li><em class="border2">' + (i + 1) + '</em><span class="scolor">' + regionList[i].region_name + '</span><p class="scolor">' + regionList[i].vst_cnts + '<span class="sp">人数</span></p></li>';
				}
			}
			$('#regionULId').html(regionULHtml);
	});
}

/**
 * 初始化分类区域图标
 */
function showClassCharts() {
	//初始化景区分类饼图
	showClassRegionCharts();

	//初始化旅行社分类柱状图
	showClassAgentCharts();

	//初始化酒店分类饼图
	showClassGudieCharts();

	//初始化导游分类柱状图
	showClassHotelCharts();
}

/**
 * 初始化景区分类饼图
 */
function showClassRegionCharts() {
//	var url = CONTENT_PATH + "/com.asiainfo.zhly.ScreenAction.queryClassChartsList.invoke";
//	var bcycId = $('#yearValue').val() + $('#monthValue').val();
//	var data = {
//		"bcycId": bcycId,
//		"sqlMapId": "screen.queryRegionClassList"
//	};
//	Base.ajax({
//		url: url,
//		data: data,
//		success: function(req) {
	var bcycId = $('#yearValue').val() + $('#monthValue').val();
	var par = "&bcycId="+bcycId+"&sqlMapId="+"Screen.regionClassList";
	//var data = {
	//	"bcycId": bcycId
	//}
	//alert(bcycId);
	Util.ajax.postJsonSync(srvMap.get('regionClassList'),par,function(json,status){
			hideLoading(myChart_regionPieCharts);
			if (null == json || null == json.object.chartList || json.object.chartList.length == 0) {
				noDataShowSource(myChart_regionPieCharts, 'regionClassChartsDiv');
				return;
			}

			var chartList = json.object.chartList;
			var dataPie = [];
			
			for (var i = 0; i < chartList.length; i++) {
				var proName = chartList[i].region_type;
				var proValue = chartList[i].vst_cnts || 0;

				var obj = {
					"value": proValue,
					"name": proName
				}
				dataPie.push(obj);
			}
			require.config({
				paths: {
					echarts: CONTENT_PATH + '/common/js'
				}
			});
			require(['echarts', 'echarts/chart/pie'], function(ec) {
				option = {
					title: {
						text: '',
						x: 'center'
					},
					tooltip: {
						trigger: 'item',
						formatter: "{b}景区 :<br/>{c}人 ({d}%)"
					},
					calculable: false,
					series: [{
						type: 'pie',
						radius: [15, 65],
						roseType: 'area',	
						x: '100%',
						data: dataPie,
						itemStyle: {
							normal: {
								color:function(param){
									//图例与之对应的颜色
									var colorList = ['#13AAAC', '#7830EF', '#2B6AE4','#517DA3'];
									if( param.data.name == '2A' ){
										return colorList[0];
									}else if( param.data.name == '3A' ){
										return colorList[1];
									}else if( param.data.name == '4A' ){
										return colorList[2];
									}
									return colorList[3];
								},
								label: {
									show: true,
									formatter: '{d}%',
									textStyle: {
										color: '#fff',
										fontSize:18
									}
								},
								labelLine: {
									show: true,
									length:-1
								}
							}
						}
					}]
				};

				myChart_regionPieCharts = ec.init(document.getElementById('regionClassChartsDiv'), 'macarons');
				myChart_regionPieCharts.clear();
				myChart_regionPieCharts.setOption(option);
			});
		});
}

/**
 * 初始化旅行社分类柱状图
 */
function showClassAgentCharts() {
//	var url = CONTENT_PATH + "/com.asiainfo.zhly.ScreenAction.queryClassChartsList.invoke";
//	var bcycId = $('#yearValue').val() + $('#monthValue').val();
//	var data = {
//		"bcycId": bcycId,
//		"sqlMapId": "screen.queryAgentClassList"
//	};
//	Base.ajax({
//		url: url,
//		data: data,
//		success: function(req) {
	var bcycId = $('#yearValue').val() + $('#monthValue').val();
	var par = "&bcycId="+bcycId+"&sqlMapId="+"Screen.agentClassList";
	//var data = {
	//	"bcycId": bcycId
	//}
	//alert(bcycId);
	Util.ajax.postJsonSync(srvMap.get('agentClassList'),par,function(json,status){
			hideLoading(myChart_agentBarCharts);
			if (null == json.object || null == json.object.chartList || json.object.chartList.length == 0) {
				noDataShowSource(myChart_agentBarCharts, 'agentClassChartsDiv');
				return;
			}

			var chartList = json.object.chartList;
			var dataBar = [];

			var totalNum = 0;
			for (var i = 0; i < chartList.length; i++) {
				var proValue = chartList[i].agent_cnts || 0;
				var proName = chartList[i].agent_type;
				
				totalNum += parseInt(proValue);
				var obj = {				
					"cnt":proValue,
					"value": proValue,
					"name": proName
				}
				
				dataBar.push(obj);
			}
			
			var _tmpValue = 0;
			for( var i = 0; i < dataBar.length; i++ ){
				if( dataBar[i] ){
					if( dataBar[i].value == 0 ){
						dataBar[i].value = '-';
					}else{
						_tmpValue = (dataBar[i].value*1.0/totalNum)*100.0;
						dataBar[i].value = _tmpValue.toFixed(2);
					}
				}
			}
			require.config({
				paths: {
					echarts: CONTENT_PATH + '/common/js'
				}
			});
			require(['echarts', 'echarts/chart/bar'], function(ec) {
				option = {
					title: {
						text: '',
						x: 'center'
					},
					tooltip: {
						trigger: 'item',
						formatter: function(params) {
							var tipHtml = params.name + '</br>' + ( params.data.cnt || 0 ) + '家';
							return tipHtml;
						}
					},
					calculable: false,
					grid: {
						borderWidth: 1,
						x: 23,
						y: 10,
						x2: 20,
						y2: 10,
						borderColor: '#424242'
					},
					xAxis: [{
						type: 'category',
						show: false,
						data: ['出境', '非出境', ]
					}],
					yAxis: [{
						type: 'value',
						max:108,
						//min:0,
						show: false
					}],
					series: [{
						type: 'bar',
						barWidth: 30,
						barMinHeight:3,
						itemStyle: {
							normal: {
								color: function(param) {
									var colorList = [
										'#13AAAC', '#7830EF'
									];
									if( param.data.name == "出境" ){
										return colorList[0];
									}
									return colorList[1];
								},
								label: {
									show: true,
									position: 'top',
									formatter: '{c}%',
									textStyle:{
										color:'#FFFFFF',
										fontSize:16
									}
								}
							}
						},
						data: dataBar
					}]
				};

				myChart_agentBarCharts = ec.init(document.getElementById('agentClassChartsDiv'), 'macarons');
				myChart_agentBarCharts.clear();
				myChart_agentBarCharts.setOption(option);
			});
	});
}

/**
 * 初始化酒店分类饼图
 */
function showClassHotelCharts() {
//	var url = CONTENT_PATH + "/com.asiainfo.zhly.ScreenAction.queryClassChartsList.invoke";
//	var bcycId = $('#yearValue').val() + $('#monthValue').val();
//	var data = {
//		"bcycId": bcycId,
//		"sqlMapId": "screen.queryHotelClassList"
//	};
//	Base.ajax({
//		url: url,
//		data: data,
//		success: function(req) {
	var bcycId = $('#yearValue').val() + $('#monthValue').val();
	var par = "&bcycId="+bcycId+"&sqlMapId="+"Screen.hotelClassList";
	//var data = {
	//	"bcycId": bcycId
	//}
	//alert(bcycId);
	Util.ajax.postJsonSync(srvMap.get('queryClassList'),par,function(json,status){
			hideLoading(myChart_hotelPieCharts);
			if (null == json.object || null == json.object.chartList || json.object.chartList.length == 0) {
				noDataShowSource(myChart_hotelPieCharts, 'hotelClassChartsDiv');
				return;
			}

			var chartList = json.object.chartList;
			var dataPie = [];

			for (var i = 0; i < chartList.length; i++) {
				var proValue = chartList[i].person_cnts || 0;
				var proName = chartList[i].hotel_type;

				var obj = {
					"value": proValue,
					"name": proName
				}
				dataPie.push(obj);
			}
			require.config({
				paths: {
					echarts: CONTENT_PATH + '/common/js'
				}
			});
			
			require(['echarts', 'echarts/chart/pie'], function(ec) {
				option = {
					title: {
						text: '',
						x: 'center'
					},
					tooltip: {
						trigger: 'item',
						formatter: '{b}:<br/>{c}家 ({d}%)'
					},
					calculable: false,
					series: [{
						type: 'pie',
						radius: [15, 65],
						roseType: 'area',
						x: '100%',
						data: dataPie,
						itemStyle: {
							normal: {
								color:function(param){
									//图例与之对应的颜色
									var colorList = ['#13AAAC', '#7830EF', '#2B6AE4','#517DA3','#61A088'];
									if( param.data.name == '一星' ){
										return colorList[0];
									}else if( param.data.name == '二星' ){
										return colorList[1];
									}else if( param.data.name == '三星' ){
										return colorList[2];
									}else if( param.data.name == '四星' ){
										return colorList[3];
									}

									return colorList[4];
								},
								label: {
									show: true,
									formatter: '{d}%',
									textStyle: {
										color: '#fff',
										fontSize:18
									}
								},
								labelLine: {
									show: true,
									length:-1
								}
							}
						}
					}]
				}

				myChart_hotelPieCharts = ec.init(document.getElementById('hotelClassChartsDiv'), 'macarons');
				myChart_hotelPieCharts.clear();
				myChart_hotelPieCharts.setOption(option);
			});
	});
}

/**
 * 初始化导游分类柱状图
 */
function showClassGudieCharts() {
//	var bcycId = $('#yearValue').val() + $('#monthValue').val();
//	var par = "&bcycId="+bcycId+"&sqlMapId="+"screen.queryGudieClassList";
//	
//	Util.ajax.postJsonSync(srvMap.get('queryClassChartsList'),par,function(json,status){
	var bcycId = $('#yearValue').val() + $('#monthValue').val();
	var par = "&bcycId="+bcycId+"&sqlMapId="+"Screen.guideClassList";
	//var data = {
	//	"bcycId": bcycId
	//}
	//alert(bcycId);
	Util.ajax.postJsonSync(srvMap.get('queryClassList'),par,function(json,status){
		hideLoading(myChart_guideBarCharts)
		if(status){
			var chartList = json.object.chartList;
			var dataBar = [];

			var totalNum = 0;
			for (var i = 0; i < chartList.length; i++) {
				var proName = chartList[i].guide_type;
				var proValue = chartList[i].guide_cnts || 0;
						
				totalNum += parseInt(proValue);
				
				var obj = {
					"cnt":proValue,
					"value": proValue,
					"name": proName
				}
				
				//dataBar.push(obj);
				//图例固定了顺序，得进行排序
				if( proName == "初级" ){
					dataBar[0] = obj;
				}else if( proName == "中级" ){
					dataBar[1] = obj;
				}else if( proName == "高级" ){
					dataBar[2] = obj;
				}else{
					dataBar[3] = obj;
				}
			}

			
			var _tmpValue = 0;
			for( var i = 0; i < dataBar.length; i++ ){
				if( dataBar[i] ){
					if( dataBar[i].value == 0 ){
						dataBar[i].value = '-';
					}else{
						_tmpValue = (dataBar[i].value*1.0/totalNum)*100.0;
						dataBar[i].value = _tmpValue.toFixed(2);
					}
				}
			}
			
			require.config({
				paths: {
					echarts: CONTENT_PATH + '/common/js'
				}
			});
			require(['echarts', 'echarts/chart/bar'], function(ec) {
				option = {
					title: {
						text: '',
						x: 'center'
					},
					tooltip: {
						trigger: 'item',
						formatter: function(params) {
							var tipHtml = params.name + '</br>' + ( params.data.cnt || 0 ) + '人';
							return tipHtml;
						}
					},
					calculable: false,
					grid: {
						borderWidth: 1,
						x: 23,
						y: 10,
						x2: 5,
						y2: 10,
						borderColor: '#424242'
					},
					xAxis: [{
						type: 'category',
						show: false,
						data: ['初级', '中级', '高级', '特级']
					}],
					yAxis: [{
						type: 'value',
						max:108,
						//min:0,
						show: false
					}],
					series: [{
						type: 'bar',
						barWidth: 30,
						barMinHeight:3,
						itemStyle: {
							normal: {
								color: function(param) {
									var colorList = [
										'#13AAAC', '#7830EF', '#0069E1', '#3E7C9C'
									];
									if( param.data.name == "初级" ){
										return colorList[0];
									}else if( param.data.name == "中级" ){
										return colorList[1];
									}else if( param.data.name == "高级" ){
										return colorList[2];
									}
									return colorList[3];
								},
								label: {
									show: true,
									position: 'top',
									formatter: '{c}%',
									textStyle: {
										color:'#FFFFFF',
										fontSize:16
									}
								}
							}
						},
						data: dataBar
					}]
				};

				myChart_guideBarCharts = ec.init(document.getElementById('gudieClassChartsDiv'), 'macarons');
				myChart_guideBarCharts.clear();
				myChart_guideBarCharts.setOption(option);
			});
			
			
		}else{
			noDataShowSource(myChart_guideBarCharts, 'gudieClassChartsDiv');   
		}
	});
	
//	var url = CONTENT_PATH + "/com.asiainfo.zhly.ScreenAction.queryClassChartsList.invoke";
//	var bcycId = $('#yearValue').val() + $('#monthValue').val();
//	var data = {
//		"bcycId": bcycId,
//		"sqlMapId": "screen.queryGudieClassList"
//	};
//	Base.ajax({
//		url: url,
//		data: data,
//		success: function(req) {
//			hideLoading(myChart_guideBarCharts);
//			if (null == req || null == req.chartList || req.chartList.length == 0) {
//				noDataShowSource(myChart_guideBarCharts, 'gudieClassChartsDiv');
//				return;
//			}
//
//			var chartList = req.chartList;
//			var dataBar = [];
//
//			var totalNum = 0;
//			for (var i = 0; i < chartList.length; i++) {
//				var proName = chartList[i].guide_type;
//				var proValue = chartList[i].guide_cnts || 0;
//						
//				totalNum += parseInt(proValue);
//				
//				var obj = {
//					"cnt":proValue,
//					"value": proValue,
//					"name": proName
//				}
//				
//				//dataBar.push(obj);
//				//图例固定了顺序，得进行排序
//				if( proName == "初级" ){
//					dataBar[0] = obj;
//				}else if( proName == "中级" ){
//					dataBar[1] = obj;
//				}else if( proName == "高级" ){
//					dataBar[2] = obj;
//				}else{
//					dataBar[3] = obj;
//				}
//			}
//
//			
//			var _tmpValue = 0;
//			for( var i = 0; i < dataBar.length; i++ ){
//				if( dataBar[i] ){
//					if( dataBar[i].value == 0 ){
//						dataBar[i].value = '-';
//					}else{
//						_tmpValue = (dataBar[i].value*1.0/totalNum)*100.0;
//						dataBar[i].value = _tmpValue.toFixed(2);
//					}
//				}
//			}
//			
//			require.config({
//				paths: {
//					echarts: CONTENT_PATH + '/common/js'
//				}
//			});
//			require(['echarts', 'echarts/chart/bar'], function(ec) {
//				option = {
//					title: {
//						text: '',
//						x: 'center'
//					},
//					tooltip: {
//						trigger: 'item',
//						formatter: function(params) {
//							var tipHtml = params.name + '</br>' + ( params.data.cnt || 0 ) + '人';
//							return tipHtml;
//						}
//					},
//					calculable: false,
//					grid: {
//						borderWidth: 1,
//						x: 23,
//						y: 10,
//						x2: 5,
//						y2: 10,
//						borderColor: '#424242'
//					},
//					xAxis: [{
//						type: 'category',
//						show: false,
//						data: ['初级', '中级', '高级', '特级']
//					}],
//					yAxis: [{
//						type: 'value',
//						max:108,
//						//min:0,
//						show: false
//					}],
//					series: [{
//						type: 'bar',
//						barWidth: 30,
//						barMinHeight:3,
//						itemStyle: {
//							normal: {
//								color: function(param) {
//									var colorList = [
//										'#13AAAC', '#7830EF', '#0069E1', '#3E7C9C'
//									];
//									if( param.data.name == "初级" ){
//										return colorList[0];
//									}else if( param.data.name == "中级" ){
//										return colorList[1];
//									}else if( param.data.name == "高级" ){
//										return colorList[2];
//									}
//									return colorList[3];
//								},
//								label: {
//									show: true,
//									position: 'top',
//									formatter: '{c}%',
//									textStyle: {
//										color:'#FFFFFF',
//										fontSize:16
//									}
//								}
//							}
//						},
//						data: dataBar
//					}]
//				};
//
//				myChart_guideBarCharts = ec.init(document.getElementById('gudieClassChartsDiv'), 'macarons');
//				myChart_guideBarCharts.clear();
//				myChart_guideBarCharts.setOption(option);
//			});
//		}
//	});
}

/**
 * 初始化景区客流分布图
 */
function showRegionMapCharts() {
	//var url = CONTENT_PATH + "/com.asiainfo.zhly.ScreenAction.queryRegionMapChartsList.invoke";

	//var data = {
	//	"bcycId": bcycId
	//};
//	Base.ajax({
//		url: url,
//		data: data,
//		success: function(req) {
	var bcycId = $('#yearValue').val() + $('#monthValue').val();
	var par = "&bcycId="+bcycId;
	
	Util.ajax.postJsonSync(srvMap.get('vstDistInProv'),par,function(json,status){
			hideLoading(myChart_regionMapCharts);
			if (null == json || null == json.object || json.object.regions.length == 0) {
				noDataShowSource(myChart_regionMapCharts, 'regionMapChartsDiv');
				return;
			}

			var regionMapList = json.object.regions.regionMapList;
			var mapData = [];
			
			for (var i = 0; i < regionMapList.length; i++) {
				var proName = regionMapList[i].region_name;
				var proValue = regionMapList[i].vst_person_cnts || 0;
				var longitude = regionMapList[i].core_longitude;
				var latitude = regionMapList[i].core_latitude;

				var geoObj = [];
				geoObj.push(Number(longitude));
				geoObj.push(Number(latitude));

				var obj = {
					"name": proName,
					"value": proValue,
					"geoCoord": geoObj
				}

				mapData.push(obj);
			}

			//确定边界
			var edge1 = {start:json.object.regions.edgeInfo[0],end:json.object.regions.edgeInfo[1]};
			var edge2 = {start:json.object.regions.edgeInfo[2],end:json.object.regions.edgeInfo[3]};
			var edge3 = {start:json.object.regions.edgeInfo[4],end:json.object.regions.edgeInfo[5]};
			var edge4 = {start:json.object.regions.edgeInfo[6],end:json.object.regions.edgeInfo[7]};
			var edge5 = {start:json.object.regions.edgeInfo[8],end:json.object.regions.edgeInfo[9]};

			require.config({
				paths: {
					echarts: CONTENT_PATH + '/common/js'
				}
			});
			require(['echarts', 'echarts/chart/map'], function(ec) {
				option = {
					title: {
						text: '',
						x: 'center'
					},
					color: [
						'rgba(253, 48, 35, 0.8)',
						'rgba(255, 114, 0, 0.8)',
						'rgba(255, 174, 0, 0.8)',
						'rgba(155, 199, 2, 0.8)',
						'rgba(70, 176, 53, 0.8)'
					],
					calculable: false,
					legend: {
						orient : 'vertical',
						x : 'left',
						y : '50%',
						z : 5,
						itemWidth:15,
						textStyle:{
							fontSize:0
						},
						//itemGap:15,
						data:['极高','特高','高','中','低']
					},
					dataRange: {
						min: 0,
						max: edge5.end,
						x: 'left',
						y: 'bottom',
						text: ['高', '低'], // 文本，默认为数值文本
						calculable: false,
						selectedMode:false,
						hoverLink:false,
						//color: ['#FD3023', '#FF7200', '#FFAE00', '#9BC702', '#46B035'],
						color: ['#000000', '#000000', '#000000', '#000000', '#000000'],
						orient: 'vertical',
						show: true,
						textStyle: {
							color: '#FFFFFF'
						}
					},
					series: [{
						name: '极高',
						type: 'map',
						mapType: prov_name_short,
						hoverable: false,
						itemStyle: {
							normal: {
								borderColor: 'rgba(100,149,237,1)',
								borderWidth: 1.5,
								areaStyle: {
									color: '#000000'
								}
							}
						},
						data: [],
						markPoint: {
							symbol: 'circle',
							symbolSize: 7,
							large: true,
							effect: {
								show: true,
								color: '#FD3023'
							},
							data: (function() {
								var data = [];
								var geoCoord;
								var value;
								var name;
								for (var i = 0; i < mapData.length; i++) {
									geoCoord = mapData[i].geoCoord;
									value = parseInt(mapData[i].value);
									name = mapData[i].name;

									if ( value >= edge5.start ) {
										data.push({
											name: name,
											value: value,
											geoCoord: geoCoord
										})
									}
								}
								if (data.length == 0) {
									data.push({
										name: '',
										value: '',
										geoCoord: []
									})
								}
								return data;
							})()
						}
					}, {
						name: '特高',
						type: 'map',
						mapType: prov_name_short,
						hoverable: false,
						data: [],
						markPoint: {
							symbol: 'circle',
							symbolSize: 6,
							large: true,
							effect: {
								show: true,
								color: '#FF7200'
							},
							data: (function() {
								var data = [];
								var geoCoord;
								for (var i = 0; i < mapData.length; i++) {
									var geoCoord = mapData[i].geoCoord;
									var value = parseInt(mapData[i].value);
									var name = mapData[i].name;

									if ( value >= edge4.start && value < edge5.start) {
										data.push({
											name: name,
											value: value,
											geoCoord: geoCoord
										})
									}
								}
								if (data.length == 0) {
									data.push({
										name: '',
										value: '',
										geoCoord: []
									})
								}
								return data;
							})()
						}
					}, {
						name: '高',
						type: 'map',
						mapType: prov_name_short,
						hoverable: false,
						data: [],
						markPoint: {
							symbol: 'circle',
							symbolSize: 5,
							large: true,
							effect: {
								show: true,
								color: '#FFAE00'
							},
							data: (function() {
								var data = [];
								var geoCoord;
								for (var i = 0; i < mapData.length; i++) {
									var geoCoord = mapData[i].geoCoord;
									var value = parseInt(mapData[i].value);
									var name = mapData[i].name;

									if ( value >= edge3.start && value < edge4.start) {
										data.push({
											name: name,
											value: value,
											geoCoord: geoCoord
										})
									}
								}
								if (data.length == 0) {
									data.push({
										name: '',
										value: '',
										geoCoord: []
									})
								}
								return data;
							})()
						}
					}, {
						name: '中',
						type: 'map',
						mapType: prov_name_short,
						hoverable: false,
						data: [],
						markPoint: {
							symbol: 'circle',
							symbolSize: 4,
							large: true,
							effect: {
								show: true,
								color: '#9BC702'
							},
							data: (function() {
								var data = [];
								var geoCoord;
								for (var i = 0; i < mapData.length; i++) {
									var geoCoord = mapData[i].geoCoord;
									var value = parseInt(mapData[i].value);
									var name = mapData[i].name;

									if ( value >= edge2.start && value < edge3.start) {
										data.push({
											name: name,
											value: value,
											geoCoord: geoCoord
										})
									}
								}
								if (data.length == 0) {
									data.push({
										name: '',
										value: '',
										geoCoord: []
									})
								}
								return data;
							})()
						}
					}, {
						name: '低',
						type: 'map',
						mapType: prov_name_short,
						hoverable: false,
						data: [],
						markPoint: {
							symbol: 'circle',
							symbolSize: 3,
							large: true,
							effect: {
								show: true,
								color: '#46B035'
							},
							data: (function() {
								var data = [];
								var geoCoord;
								for (var i = 0; i < mapData.length; i++) {
									var geoCoord = mapData[i].geoCoord;
									var value = parseInt(mapData[i].value);
									var name = mapData[i].name;

									if ( value >= edge1.start && value < edge2.start) {
										data.push({
											name: name,
											value: value,
											geoCoord: geoCoord
										})
									}
								}
								if (data.length == 0) {
									data.push({
										name: '',
										value: '',
										geoCoord: []
									})
								}
								return data;
							})()
						}
					}]
				};

				myChart_regionMapCharts = ec.init(document.getElementById('regionMapChartsDiv'), 'macarons');
				myChart_regionMapCharts.clear();
				myChart_regionMapCharts.setOption(option);
			});
		}
	);
}

function noDataShowSource(chart, id) {
	if (chart == null) {
		require.config({
			paths: {
				echarts: CONTENT_PATH + '/common/js'
			}
		});
		require(['echarts', 'echarts/chart/map', 'echarts/chart/line', 'echarts/chart/bar', 'echarts/chart/pie'], function(ec) {
			chart = ec.init(document.getElementById(id), 'macarons');
			chart.clear();
			showEmptyTip(chart);
		});
	} else {
		showEmptyTip(chart);
	}
}

function showEmptyTip(chart) {
	chart.clear();
	if (chart != null) {
		chart.showLoading({
			text: '当前未查询到数据，请稍后再试',
			effect: 'bubble',
			textStyle: {
				fontSize: 22
			}
		});
	}
}

function hideLoading(chart) {
	if (chart != null) {
		chart.hideLoading();
	}
}

/**
 * 刷新当前时间
 * @author wucm
 * @date   2015-11-10T17:30:16+0800
 * @param  {[type]}                 argument [description]
 * @return {[type]}                          [description]
 */
function reflashTime() {
	var _o = $("#timeNow");
	setInterval(function() {
		var now = new Date().format("yyyy-MM-dd hh:mm:ss");
		_o.html(now);
	}, 1);
}


/**
 * 初始化月份选择DIV
 */
function initMonth() {
	
	//1、获取当前时间
	var d = new Date();
	var year = d.getFullYear();
	var prevYear = year-1;
	var mon = d.getMonth()+1;
	var prevMon = mon - 1;
	var strPrevMon = prevMon;
	var strMon = mon;
	currentYear = year;
	if( mon < 10 ){
		strMon = "0" + mon;
	}
	if( strPrevMon < 10 ){
		strPrevMon = "0" + prevMon;
	}
	
	//给年月赋值(查询参数使用)--上一个月，注意跨年情况
	var isFirstMonth = (mon == 1);
	if( isFirstMonth ){
		$('#yearValue').val(prevYear);
		$('#monthValue').val("12");
	}else{
		$('#yearValue').val(year);
		$('#monthValue').val(strPrevMon);
	}
	

	//2、控件内容生成--每行6个月份
	var i = 1;
	
	//去年
	var prevYearHtml = '<h2>' + prevYear + '年</h2><ul id="prevMonList">';
	for ( i = 7; i <= 12; i++ ) {
		strMon = i;
		if( i < 10 ){
			strMon = "0" + i;
		}
		if( isFirstMonth && (12 == i) ){
			prevYearHtml += '<li class="choose" onclick="selectMonth(this,\'' + prevYear + '\',\'' + strMon + '\')" style="cursor: pointer;">' + strMon + '月</li>';
		}else{
			prevYearHtml += '<li onclick="selectMonth(this,\'' + prevYear + '\',\'' + strMon + '\')" style="cursor: pointer;">' + strMon + '月</li>';
		}
	}
	prevYearHtml += '</ul>';
	
	//今年
	var curYearHtml = '<h2>' + year + '年</h2><ul id="curMonList">';
	for ( i = 1; i <= mon; i++ ) {
		strMon = i;
		if( i < 10 ){
			strMon = "0" + i;
		}
		
		if( i == mon ){
			curYearHtml += '<li disabled="disabled" style="color:#878787;">' + strMon + '月</li>';
			//curYearHtml += '<li class="gray">' + strMon + '月</li>';
		}else if( i == prevMon ){
			curYearHtml += '<li class="choose" onclick="selectMonth(this,\'' + year + '\',\'' + strMon + '\')" style="cursor: pointer;">' + strMon + '月</li>';
		}else{
			curYearHtml += '<li onclick="selectMonth(this,\'' + year + '\',\'' + strMon + '\')" style="cursor: pointer;">' + strMon + '月</li>';
		}
	}
	curYearHtml += '</ul>';
	
	var contentHtml = prevYearHtml + curYearHtml;
	$('#bcycIdContentDiv').html(contentHtml);
}

/**
 * 初始化选择框内容
 * @param strMon
 */
function initBcycId(strMon) {

	var monthHtml = '<ul id="monList">';
	var curMonth = Number(strMon);
	for (var i = 1; i <= 12; i++) {
		if ( i == curMonth ) {
			monthHtml += '<li class="choose" onclick="selectMonth(\'' + i + '\')" style="cursor: pointer;">' + i + '月</li>'
		} else if ( i < curMonth ) {
			monthHtml += '<li onclick="selectMonth(\'' + i + '\')" style="cursor: pointer;">' + i + '月</li>'
		} else {
			monthHtml += '<li disabled="disabled" style="color:#878787;">' + i + '月</li>'
		}
	}
	monthHtml += '</ul>';

	$('#bcycIdContentDiv').html(monthHtml);
}

/**
 * 选择月份操作
 * @param value
 */
function selectMonth(obj,year,strMon) {
	/*var monthValue = 0;
	var yearValue = currentYear;

	if (value < 1) {
		monthValue = Number(value) + 12;
		yearValue = yearValue - 1;
	} else {
		monthValue = value;
	}

	if (monthValue < 10) {
		monthValue = '0' + monthValue;
	} else {
		monthValue = monthValue;
	}*/
	
	$('#yearValue').val(year);
	$('#monthValue').val(strMon);

	$('#bcycIdBgId').hide();
	$('#bcycIdContentDiv').hide();
	
	//设置当前选择的月份高亮
	$("#curMonList li").removeClass("choose");
	$("#prevMonList li").removeClass("choose");
	$(obj).addClass("choose");

	//更新所有标题显示
	//showTitle();
	//更新所有相关时间的数据信息
	refreshPage();
}

/**
 * 初始化标题
 */
function showTitle() {
	$("#headerPic").css("background-image","url(assets/css/images/header/"+DEPLOY_PROVINCE+"/lgscreen_headerbg_h1bg.png)");
	var yearValue = $('#yearValue').val();
	var monthValue = $('#monthValue').val();

	var oneTitleHtml = yearValue + '年' + monthValue + '月份全国各省市来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'人数分布';
	var twoTitleHtml = yearValue + '年来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'总人数';
	var threeTitleHtml = yearValue + '年' +'来'+DEPLOY_PROVINCE_NAME_SHORTHAND+'月份分布';
	var fourTitleHtml = yearValue + '年' + monthValue + '月份景区热度排行<em>Top5</em>';

	$('#oneTitle').html(oneTitleHtml);
	$('#twoTitle').html(twoTitleHtml);
	$('#threeTitle').html(threeTitleHtml);
	$('#fourTitle').html(fourTitleHtml);
}

/**
 * 初始化点击进入客流监控平台
 */
function initInExtendSystem() {
	$('#inRegionSystem').attr('target', '_blank');
	$('#inRegionSystem').attr('href', indexUrl);
}

/**
 * 点击全屏事件
 */
function onclickScreenFull() {
	myChart_sourceMapCharts.clear(); //先清除原来显示地图
	hideLoading(myChart_sourceMapCharts);
	if (!$('#screenFullDivId').hasClass('lgscreen-content-box-full')) {
		//点击全屏
		$('.lgscreen-header').hide();
		$('#screenFullDivId').addClass('lgscreen-content-box-full');
		$('#flagValue').val('true');
		
		$("#oneTitle").css("font-size","32px");
		showSourceMapCharts(true);
	} else {
		$('.lgscreen-header').show();
		$('#screenFullDivId').removeClass('lgscreen-content-box-full');
		$('#flagValue').val('false');
		
		//正常展示
		$("#oneTitle").css("font-size","22px");
		showSourceMapCharts(false);
	}
}


/**
 * 
 * @Description : 定时刷新客流分布图
 * @return void
 * 
 * @author : xuxiong
 * @date : 2015年11月27日 15:36:24
 * 
 */
function refreshRegionMapCharts(){
	setInterval(function() {
		showRegionMapCharts();
	}, 1000*60*5);	//5分钟刷新一次
}